﻿<script type="text/javascript">
$(function() {
	$(".delSendLetter").each(function() {
		$(this).click(function() {
			var letterId = $(this).attr("title");
			$.ajax({
				type:"POST",
				url:"<?=base_url()?>index.php/stationLetters/deleteSendLetterById",
				data:"letterId="+letterId,
				success:function() {
					location.reload();
				}
			});
		});
	})
	$(".replyReceivedLetter").each(function() {
		$(this).click(function() {
			var letterId = $(this).attr("title");
			$.ajax({
				type:"GET",
				url:"<?=base_url()?>index.php/stationLetters/echoJsonReceivedLetterContentById",
				data:"letterId="+letterId,
				dataType:"json",
				success:function(data) {
					//alert(data.sender);
					$("#letter_type").val(data.letter_type);
					$("#recipient").val(data.recipient);
					$("#sender").val(data.sender);
					$("#letter_title").val(data.letter_title);
					$("#letter_content").val("----------------------原始信件----------------------<br/>"+
						data.letter_content+
						"<br/>----------------------回复信件----------------------<br/>");
					$( "#dlgReply" ).dialog("open");
				}
			});
		})
	});
})
</script>
	<div class="content">
		<div class="xinx_left">
			<div class="bmlf_lf1 xinx_lful">
				<ul>
					<li class="xx1_hover1"><a href=""><strong>我的信箱</strong></a></li>
					<li class="xx1_hover2"><a href="<?=base_url()?>index.php/stationLetters/listReceivedLetters"><strong>收到的</strong></a></li>
					<li class="xx1_hover3"><a href="<?=base_url()?>index.php/stationLetters/listSendLetters"><strong>已发出</strong></a></li>
					<li class="xx1_hover4"><a href="<?=base_url()?>index.php/stationLetters/listUnreadLetters"><strong>收到的提示</strong></a></li>
				</ul>
			</div><!-- end bmlf_lf1 -->
		</div><!-- end xinx_left -->
		
		<div class="xinx_right">
			<div class="xx_rg1">
				<div class="xx_rg11"></div>
				<div class="xx_rg12"></div>
				<div class="xx_rg13"></div>
			</div>
				
			<div class="xx_rg2">
				<div class="xx_rg21">
					<div class="xx_rig1">
						<div style="text-align:center;vertical-align:middle;line-height:30px;"><b><?=$results['letter_title']?></b></div>
						<p class="rig1_p1">
							<div style="margin-left:500px;"><b>来自于:<?=$results['nickName']?></b></div>
							
                            <div class="message_title_img1">
                            	<span class="message_title_text">
								<?=$results['letter_content']?>
								</span>
                            </div>
						</p>
						
						<p class="rig1_p3">
							<a href="javascript:void(0);"><?=$results['createTime']?></a>
							<a href="javascript:void(0);" class="replyReceivedLetter" title="<?=$results['letterId']?>">回复</a>
						</p>
					</div>
				</div><!-- end xx_rg21 -->			
			</div>
			
			<div class="xx_rg3"></div>
		</div><!-- end xinx_right -->
	</div><!-- end content -->
	
	<div class="footer">
		<p class="foot_p">点点网2012探索点点 点点推荐 京ICP备10217266号 京公网安备110108008162号</p>
	</div>
</div><!-- end wrap -->
<div id="dialog" title="站内信" class="ui-widget" style="display:none;">
	<form id="dlg_write_letter" action="<?=base_url()?>index.php/stationLetters/writeLetter" method="post">
		<table height="100%">
			<tr height="40">
				<td>收件人：</td>
				<td>
					<input type="text" size="30"/>
					<input type="hidden" name="recipient" value="2"/>
				</td>
			</tr>
			<tr height="40"><td>类型：</td><td><input type="text"  name="letter_type" size="30"/></td></tr>
			<tr height="40"><td>主题：</td><td><input type="text"  name="letter_title" size="30"/></td></tr>
			<tr height="40"><td>内容：</td><td><textarea cols="50" name="letter_content" rows="15"></textarea></td></tr>
		</table>
	</form>
</div>
<div id="dlgReply" title="回复" class="ui-widget" style="display:none;">
	<form id="dlg_reply_letter" action="<?=base_url()?>index.php/stationLetters/replyLetter" method="post">
		<table height="100%">
			<tr height="40">
				<td>类型：</td>
				<td>
					<input type="text"  name="letter_type" id="letter_type" size="30"/>
					<input type="hidden" name="recipient" id="recipient" value=""/>
					<input type="hidden" name="sender" id="sender" value=""/>
					<input type="hidden" name="isRead" value="未读"/>
					<input type="hidden" name="createTime" value="<?=date('Y-m-d H:i:s')?>"/>
				</td>
			</tr>
			<tr height="40"><td>主题：</td><td><input type="text"  name="letter_title" id="letter_title" size="30"/></td></tr>
			<tr height="40"><td>内容：</td><td><textarea cols="50" name="letter_content" id="letter_content" rows="15"></textarea></td></tr>
		</table>
	</form>
</div>
</body>
</html>
